package com.ruoyi.carrepair.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.zjc.SnowflakeIdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.carrepair.mapper.QxOperatelogMapper;
import com.ruoyi.carrepair.domain.QxOperatelog;
import com.ruoyi.carrepair.service.IQxOperatelogService;

/**
 * 日志管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-11-19
 */
@Service
public class QxOperatelogServiceImpl implements IQxOperatelogService 
{
    @Autowired
    private QxOperatelogMapper qxOperatelogMapper;

    /**
     * 查询日志管理
     * 
     * @param id 日志管理主键
     * @return 日志管理
     */
    @Override
    public QxOperatelog selectQxOperatelogById(String id)
    {
        return qxOperatelogMapper.selectQxOperatelogById(id);
    }

    /**
     * 查询日志管理列表
     * 
     * @param qxOperatelog 日志管理
     * @return 日志管理
     */
    @Override
    public List<QxOperatelog> selectQxOperatelogList(QxOperatelog qxOperatelog)
    {
        qxOperatelog.setToApplet(SecurityUtils.getLoginUser().getToApplet());
        return qxOperatelogMapper.selectQxOperatelogList(qxOperatelog);
    }

    /**
     * 新增日志管理
     * 
     * @param qxOperatelog 日志管理
     * @return 结果
     */
    @Override
    public int insertQxOperatelog(QxOperatelog qxOperatelog)
    {
        qxOperatelog.setToApplet(SecurityUtils.getLoginUser().getToApplet());
        qxOperatelog.setCreateID(SecurityUtils.getLoginUser().getUserId());
        qxOperatelog.setCreator(SecurityUtils.getLoginUser().getUsername());
        qxOperatelog.setCreateDate(new Date());
        qxOperatelog.setId(String.valueOf(new SnowflakeIdWorker(5,8).nextId()));
        return qxOperatelogMapper.insertQxOperatelog(qxOperatelog);
    }

    /**
     * 修改日志管理
     * 
     * @param qxOperatelog 日志管理
     * @return 结果
     */
    @Override
    public int updateQxOperatelog(QxOperatelog qxOperatelog)
    {
        return qxOperatelogMapper.updateQxOperatelog(qxOperatelog);
    }

    /**
     * 批量删除日志管理
     * 
     * @param ids 需要删除的日志管理主键
     * @return 结果
     */
    @Override
    public int deleteQxOperatelogByIds(String[] ids)
    {
        return qxOperatelogMapper.deleteQxOperatelogByIds(ids);
    }

    /**
     * 删除日志管理信息
     * 
     * @param id 日志管理主键
     * @return 结果
     */
    @Override
    public int deleteQxOperatelogById(String id)
    {
        return qxOperatelogMapper.deleteQxOperatelogById(id);
    }
}
